# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-firmata
_pkgname=pyFirmata
pkgver=1.0.3
pkgrel=10
pkgdesc="Python interface for the Firmata procotol"
url="https://github.com/tino/pyFirmata"
arch="noarch"
license="MIT"
depends="python3 py3-pyserial"
makedepends="py3-setuptools py3-gpep517"
subpackages="$pkgname-pyc"
source="$_pkgname-$pkgver.tar.gz::https://github.com/tino/pyFirmata/archive/$pkgver.tar.gz
	py311.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-firmata" # Backwards compatibility
provides="py-firmata=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m unittest discover
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
626da09ea543dd722129dd7156bb1ba185d40480689d3b0108d89a1a2c9361105822c57e50c39413d1a6ded08f20211b4606b2cb18f5a578c399fda6b00e6abb  pyFirmata-1.0.3.tar.gz
95d990613c3338d1e7e81d846bd0a1343fbaae58b02fd641f8cc05ac25f0fac25a232ca18e8abda075f99ff83564174c09347f83aec0f14338f58b2feb0de6de  py311.patch
"
